package netective.api.analyzer;

public class ByteConverter 
{
	public static String fromByteToString(byte b)  
    {  
        String s = "";  
        for (int i = 0; i < 8; i++)  
        {  
            s += (b & 1) == 1 ? "1" : "0";  
            b >>= 1;  
        } 
        
        return s;  
    }
	
	public static String fromByteToString(byte[] b)  
    {  
        String s = "";
        for(int i = 0; i < b.length; i++)
        {
        	s += fromByteToString(b[i]);
        }
        
        return s;  
    } 
	
	public static String fromByteToHexString(byte[] b)
	{
		String s = "";
		for (int i=0;i<6;i++)
		{
			s +=(":"+(b[i]>=0?Integer.toHexString(b[i]):Integer.toHexString(256+b[i])));
		}
		
		return s.substring(1);
	}	
}
